<template>
    <section id="search_main">
        个人页面  <button @click="loginout">退出</button>
        
        <div id="">
        		昵称<p :contenteditable="isEdit">{{name}}</p>	
        		<button @click="chengeEdit">修改昵称</button>
        </div>
        
    </section>
</template>

<script>
import {chengName} from "../config/axios.js"
export default {
    name: 'search',
    data () {
        return {
          	name:"未定义",
          	isEdit:false
        }
    },
    computed:{
  
    },
    directives: {
       
    },
    created () {
    
    },
    methods:{
	   loginout(){
	   		sessionStorage.removeItem("islogin")
	   		this.$router.push("/login")
	   },
	   chengeEdit(){
	   	this.isEdit=!this.isEdit
	   	if(this.isEdit==true){
	   		var data={
	   			userName:"guoxiao",
	   			newName:this.name
	   		}
	   		chengName(data).then(res=>{
	   			console.log(res.data)
	   			
	   		})
	   	}
	   }
    }
}

</script>

<style scoped>

</style>
